package com.ilancuo.thinkinjava.chapter_18;

import java.io.*;

public class BasicFileOutput {
    private static String file = "C:\\Users\\Administrator\\Desktop\\test.txt";
    private static String outFile = "C:\\Users\\Administrator\\Desktop\\out.txt";

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new StringReader(BufferedInputFile.read(file)));
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outFile)));
        int lineCount = 1;
        String s;
        while ((s = in.readLine()) != null) {
            out.println(lineCount++ + ": " + s);
        }
        out.close();
        System.out.println(BufferedInputFile.read(outFile));
    }
}
